Skip to content

Duplications detection and supplementary records - #656

Draft
NicolasBuchin wants to merge 6 commits into
mainfrom
duplications
Draft

NicolasBuchin wants to merge 6 commits into
mainfrom
duplications

Conversation

@NicolasBuchin

@NicolasBuchin NicolasBuchin commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

This PR introduces 2 things at once:

The first commit just allows reporting supplementary records, with a SA:Z tag necessary for most SV callers to understand which records belong together once a SAM file is compressed into a BAM file. There is no use to make this it's own PR until we need supplementary records, which is why it comes with this PR for duplciations.

The other commits propose a duplication detection. It works as a post-alignment step: we find the primary alignment, and before being reported it's cigar is parsed by reinterpret_insertions which searches for insertion events larger than --dl (default 50), and attempts to reinterpret them as duplications.

To count as a duplication they must pass a threshold of --dm (default 0.80) matches on the query region. The reinterpretation is done by aligning the query against the 2 sides of the reference surrounding the insertion point. After that if the duplication passes the threshold, we report it by splitting the primary into 2 segments, for which we need supplementary record support. Note that this means the 2 segments have 0 read overlap/gap, which gives us base level precise breakpoints on the read and reference. This figures shows how the Insertion region is aligned against the 2 reference regions to resolve a duplication.
INS DUP method

I might refactor it into a struct and a new file

A record can be flagged as supplementary and report the SA:Z tag to
cross-reference the other records.
After the best alignment has been picked, an insertion of at least --dl bases
(50 by default) is realigned against the reference on both sides of the
insertion point. If that beats keeping the insertion, the inserted bases are a
second copy of the reference around them, so the alignment is cut into one SAM
record per copy: the best scoring one primary, the rest supplementary with SA:Z
tags.

Adds the du:i tag in the details counting the number of duplications found on a
read.

Single-end only for now. --dl 0 turns detection off, and with --details du:i:
reports how many insertions were re-interpreted.

Is-new-baseline: yes
The two arms of a duplication stay close to the diagonal, so we bound them with
--dw (20 by default) instead of filling the whole matrix. It's cheaper, and in
practice it finds the true duplications better. Asking the split to score
better than the insertion penalty was too simple a check on its own.

Is-new-baseline: yes
A less permissive condition to consider a valid duplication, instead of beating
the insertion score, the alignments needs to be at least --dm (0.80 by default)
matches.

Is-new-baseline: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant